package com.lxmes.sales.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lxmes.common.annotation.Log;
import com.lxmes.common.core.controller.BaseController;
import com.lxmes.common.core.domain.AjaxResult;
import com.lxmes.common.enums.BusinessType;
import com.lxmes.sales.domain.NcOrderResourcesYs;
import com.lxmes.sales.service.INcOrderResourcesYsService;
import com.lxmes.common.utils.poi.ExcelUtil;
import com.lxmes.common.core.page.TableDataInfo;

/**
 * 订单资源验算Controller
 *
 * @author ruoyi
 * @date 2022-12-08
 */
@RestController
@RequestMapping("/pcplan/orderResourcesYs")
public class NcOrderResourcesYsController extends BaseController
{

    @Autowired
    private INcOrderResourcesYsService ncOrderResourcesYsService;

    /**
     * 查询订单资源验算列表
     */
    @PreAuthorize("@ss.hasPermi('pcplan:orderResourcesYs:list')")
    @GetMapping("/list")
    public TableDataInfo list(NcOrderResourcesYs ncOrderResourcesYs)
    {
        startPage();
        List<NcOrderResourcesYs> list = ncOrderResourcesYsService.selectNcOrderResourcesYsList(ncOrderResourcesYs);
        return getDataTable(list);
    }

    /**
     * 导出订单资源验算列表
     */
    @PreAuthorize("@ss.hasPermi('pcplan:orderResourcesYs:export')")
    @Log(title = "订单资源验算", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, NcOrderResourcesYs ncOrderResourcesYs)
    {
        List<NcOrderResourcesYs> list = ncOrderResourcesYsService.selectNcOrderResourcesYsList(ncOrderResourcesYs);
        ExcelUtil<NcOrderResourcesYs> util = new ExcelUtil<NcOrderResourcesYs>(NcOrderResourcesYs.class);
        util.exportExcel(response, list, "订单资源验算数据");
    }

    /**
     * 获取订单资源验算详细信息
     */
    @PreAuthorize("@ss.hasPermi('pcplan:orderResourcesYs:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(ncOrderResourcesYsService.selectNcOrderResourcesYsById(id));
    }

    /**
     * 新增订单资源验算
     */
    @PreAuthorize("@ss.hasPermi('pcplan:orderResourcesYs:add')")
    @Log(title = "订单资源验算", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NcOrderResourcesYs ncOrderResourcesYs)
    {
        return toAjax(ncOrderResourcesYsService.insertNcOrderResourcesYs(ncOrderResourcesYs));
    }

    /**
     * 修改订单资源验算
     */
    @PreAuthorize("@ss.hasPermi('pcplan:orderResourcesYs:edit')")
    @Log(title = "订单资源验算", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NcOrderResourcesYs ncOrderResourcesYs)
    {
        return toAjax(ncOrderResourcesYsService.updateNcOrderResourcesYs(ncOrderResourcesYs));
    }

    /**
     * 删除订单资源验算
     */
    @PreAuthorize("@ss.hasPermi('pcplan:orderResourcesYs:remove')")
    @Log(title = "订单资源验算", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(ncOrderResourcesYsService.deleteNcOrderResourcesYsByIds(ids));
    }
    @Log(title = "订单资源验算")
	@GetMapping("/handYs/{ids}")
    public AjaxResult handYs(@PathVariable Long[] ids)
    {
        ncOrderResourcesYsService.handYs(ids);
        return AjaxResult.success();
    }


}
